# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  include AuthenticatedSystem
  include ExceptionNotifiable
  
  local_addresses.clear
  
  before_filter :login_from_cookie
  
  session :session_key => '_openidauth_session_id'
  
  private
  def referer
    if request.env['HTTP_REFERER']
      return request.env['HTTP_REFERER'].split('#')[0]
    else
      return params[:page_name]
    end
  end
  
  def site
    begin
      if request && request.env && request.env['REQUEST_URI']
        return request.env['REQUEST_URI'].match(/^(https?:\/\/[^\/]*)/)[1]
      else
        return 'https://damnit.jupiterit.com'
      end
    rescue
      return 'https://damnit.jupiterit.com'
    end
  end
  
  
end
